package com.baitiaojun.user.api;

import com.baitiaojun.api.domain.user.FollowingGroup;
import com.baitiaojun.api.domain.user.UserFollowing;
import com.baitiaojun.api.exception.ConditionException;
import com.baitiaojun.api.vo.JsonRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Set;

/**
 * @类名 UserFollowingController
 * @作者 白条君
 * @创建日期 2022/11/20 13:25
 * @版本 1.0
 */
@RequestMapping("/user/user-following")
@Api("用户关注和分组接口")
public interface UserFollowingApi {

    @ApiOperation("添加用户关注")
    @PostMapping("/new-user-following")
    JsonRes addUserFollowing(@ApiParam(value = "关注用户实体", required = true) @Valid @RequestBody UserFollowing userFollowing, BindingResult result) throws Exception;

    @ApiOperation("添加分组")
    @PostMapping("/new-following-group")
    JsonRes addFollowingGroup(@ApiParam(value = "关注用户的分组实体", required = true) @Valid @RequestBody FollowingGroup followingGroup, BindingResult result) throws Exception;

    @ApiOperation("查看关注用户")
    @GetMapping("/search-user-following")
    JsonRes getUserFollowingsWithGroup() throws Exception;

    @ApiOperation(value = "查看分组", hidden = true)
    @GetMapping("/search-following-group")
    JsonRes getFollowingGroup() throws Exception;

    @ApiOperation(value = "获取关注用户id列表", hidden = true)
    @GetMapping("/user-following-ids")
    Set<Long> getFollowingUserIds(@RequestParam("userId") Long userId) throws ConditionException;

    @ApiOperation("取消用户关注")
    @DeleteMapping("/cancel-user-following")
    JsonRes cancelUserFollowing(@ApiParam(value = "关注用户的实体", required = true) @Valid @RequestBody UserFollowing userFollowing, BindingResult result) throws Exception;

    @ApiOperation("删除分组")
    @DeleteMapping("/cancel-following-group")
    JsonRes cancelFollowingGroup(@ApiParam(value = "关注用户的分组实体", required = true) @Valid @RequestBody FollowingGroup followingGroup, BindingResult result) throws Exception;
}
